<?php
/**
 * Zead
 *
 * LICENSE	
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/bsd-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to eu@marcelomx.com so we can send you a copy immediately.
 *
 * @category   Zead
 * @author     Marcelo Rodrigues Gonzaga <eu@marcelomx.com>
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga
 * @link       http://code.google.com/p/zead 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License
 *
 **/


/**
 * @category   Zead
 * @package    Zead_Player_Action
 * @package    Zead_Player_Action_Plugin
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License 
 */
abstract class Zead_Player_Action_Helper_Abstract
{
	/**
	 * @var Zead_Player
	 */
	protected $_player = null;
	
	/**
	 * @var Zead_Player_Request
	 */
	protected $_request = null;
	
	/**
	 * @var Zead_Player_Response
	 */
	protected $_response = null;
	
	/**
	 * Class constructor
	 *
	 * @param  Zend_Controller_Request_Abstract $request
	 * @param  Zend_Controller_Response_Abstract $response
	 */
	public function __construct (Zend_Controller_Request_Abstract  $request, Zend_Controller_Response_Abstract $response) 
	{
		$this->_request = $request;
		$this->_response = $response;	
	}
	
	/**
	 * Set the frontControlller
	 * 
	 * @param  Zead_Player $player
	 * @return Zead_Player_Plugin_Abstract
	 */
	public function setPlayer(Zead_Player $player)
	{
		$this->_player = $player;
		return $this;
	}

	/**
	 * Returns the frontController
	 * 
	 * @return Zead_Player
	 */
	public function getPlayer() 
	{
		if (null == $this->_player) {
			require_once 'Zead/Player.php';
			$this->setPlayer(Zead_Player::getInstance());
		}
		
		return $this->_player;
	}
	
	/**
	 * Returns the request object registered to current action/resource
	 * 
	 * @return Zead_Player_Request_Abstract
	 */
	public function getRequest() 
	{
		return $this->_request;	
	}

	/**
	 * Returns the response object registered to currenct action/resource
	 * 
	 * @return Zead_Player_Response_Abstract
	 */
	public function getResponse() 
	{
		return $this->_response;
	}
}

